﻿//***********************************************************************
// Assembly         : NMortgage.UI
// Author           : Mike
// Created          : 04-29-2012
//
// Last Modified By : Mike
// Last Modified On : 04-21-2012
// Description      : 
//
// Copyright        : (c) . All rights reserved.
//***********************************************************************
using System.Globalization;
namespace NMortgage.UI.Model
{
    public sealed class FixedRate : ABaseValidatedType<FixedRate, FixedRateValidator>, IDistribution
    {
        private const double DEFAULT_RATE = 3.1d;

        #region Constructors

        public FixedRate()
        {
            Rate = DEFAULT_RATE;
        }

        #endregion Constructors

        #region Properties

        public string Description
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture, Properties.Resources.FixedRateRateDescriptionFormat, Rate.ToString());
            }
        }

        public double Rate
        {
            get;
            set;
        }

        #endregion Properties

        #region Methods

        public double GetRate()
        {
            return ScaleRandomToPercentRange(Rate);
        }

        private double ScaleRandomToPercentRange(double rate)
        {
            return rate / 100d;
        }

        #endregion Methods
    }
}